home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / lib / perl5 / Sub / Name.pm
Text File  |  2008-07-18  |  1KB  |  58 lines

  1. package Sub::Name;
  2.  
  3. =head1 NAME
  4.  
  5. Sub::Name - (re)name a sub
  6.  
  7. =head1 SYNOPSIS
  8.  
  9.     use Sub::Name;
  10.  
  11.     subname $name, $subref;
  12.  
  13.     $subref = subname foo => sub { ... };
  14.  
  15. =head1 DESCRIPTION
  16.  
  17. This module has only one function, which is also exported by default:
  18.  
  19. =head2 subname NAME, CODEREF
  20.  
  21. Assigns a new name to referenced sub.  If package specification is omitted in 
  22. the name, then the current package is used.  The return value is the sub.
  23.  
  24. The name is only used for informative routines (caller, Carp, etc).  You won't 
  25. be able to actually invoke the sub by the given name.  To allow that, you need 
  26. to do glob-assignment yourself.
  27.  
  28. Note that for anonymous closures (subs that reference lexicals declared outside 
  29. the sub itself) you can name each instance of the closure differently, which 
  30. can be very useful for debugging.
  31.  
  32. =head1 AUTHOR
  33.  
  34. Matthijs van Duin <xmath@cpan.org>
  35.  
  36. Copyright (C) 2004, 2008  Matthijs van Duin.  All rights reserved.
  37. This program is free software; you can redistribute it and/or modify 
  38. it under the same terms as Perl itself.
  39.  
  40. =cut
  41.  
  42. use 5.006;
  43.  
  44. use strict;
  45. use warnings;
  46.  
  47. our $VERSION = '0.04';
  48.  
  49. use base 'Exporter';
  50. use base 'DynaLoader';
  51.  
  52. our @EXPORT = qw(subname);
  53. our @EXPORT_OK = @EXPORT;
  54.  
  55. bootstrap Sub::Name $VERSION;
  56.  
  57. 1;
  58.